﻿using System;
using System.Collections;
using UnityEngine;

namespace Ease.EaseMission.Runtime
{
    public class TestTime : MonoBehaviour
    {
        public static TestTime Instance;

        private void Awake()
        {
            Instance = this;
        }

        private void OnDestroy()
        {
            Instance = null;
        }

        public void Delay(float delayTime, Action callback)
        {
            StartCoroutine(CoDelay(delayTime, callback));
        }

        IEnumerator CoDelay(float delayTime, Action callback)
        {
            yield return new WaitForSeconds(delayTime);
            callback?.Invoke();
        }
    }
}